<!-- 个人资料 -->
<script type="text/javascript" charset="utf-8" src="/uedit/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="https://cdn.staticfile.org/ueditor/1.4.3/ueditor.all.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/uedit/lang/zh-cn/zh-cn.js"></script>
<link rel="stylesheet" href="/css/otherInformation.css">
<div class="main layui-clear" style="width: 100%;margin-bottom: 0;">
	<div class="fly-main layui-clear">
		<div class="wrap clearfix">
			<#include "/apps/user/otheruser/otherusermenu.html">
			<div class="home-right" id="commenttopic">
				<div class="content-style">
					<label class="content-title mobile-display-none">个人资料</label>
					<div class="content-main">
						<div class="user-model-left">
							<p><span>姓名</span><span>${curruser.uname!'暂无'}</span></p>
							<p><span>性别</span><span>
							<#if curruser.gender?? && curruser.gender == "0">男</#if>
							<#if curruser.gender?? && curruser.gender == "1">女</#if>
							<#if curruser.gender?? && curruser.gender == "2">保密</#if>
							</span></p>
							
						</div>
						<div class="user-model-left">
							<p><span>手机</span><span> <#if curruser.mobile!="">${curruser.mobile?substring(0,3)}****${curruser.mobile?substring(curruser.mobile?length?number-4,10)}</#if></span></p>
							<p><span>城市</span><span>${curruser.city!'暂无'}</span></p>
						</div>
						<div class="user-model-memo"style=" clear: both;">
							<p><span>个人签名</span><span>${curruser.memo!'暂无'}</span></p>
						</div>
						<div style="clear:both"></div>
					</div>
				</div>
				<div class="content-style mobile-display-none">
					<label class="content-title">留言</label>
					<div class="content-main layui-form">
						<form action="/messageboard/otherSave.html" method="post">
							<input type="hidden" name="userid" value="${curruser.id}"> 
			 				<div class="layui-input-inline" style="margin-bottom: 20px">
					          <textarea id="content" name="content"  lay-verify="content|checkContent"  placeholder="请输入内容"  style="height: 80px;"></textarea>
					        </div>							 
					        <div class="layui-input-inline">
					          <button class="layui-btn" style="width: 100px;" id="button-one" lay-submit   lay-filter="*">留言</button>
					          <a href="#" class="layui-btn layui-hide"  id="button-two">正在提交...</a>
					        </div>
					        <div style="clear: both"></div>
						</form>
					</div>
				</div>
			</div>
			<div style="text-align: center" class="front-desk">
		        <div class="laypage-main" id="topicpages"></div>
		    </div>
		</div>
	</div>
</div>

<script>
layui.use(['form' ,'laypage'], function(){
	  var form = layui.form() ;
	  form.verify({
		  checkContent: function(value, item){ 
			  var status = "";
			  value = ue.getContentTxt();
				$.ajax({
					  type:"POST",
					  url:"/checkConent",
					  data: {"content": value},
					  async: false,
					  success:function(data){
						 
						   var result = JSON.parse(data.requestmsg);
						   var resultsType = result.data[0].results[0].label;
						   if(result.data[0].results[0].suggestion!="pass"){
							   switch (resultsType)
								  {
								  case "spam":
									  status='您的内容包含垃圾信息';
								    break;
								  case "ad":
									  status='您的内容包含广告信息';
								    break;
								  case "politics":
									  status='您的内容包含渉政信息';
								    break;
								  case "terrorism":
									  status='您的内容包含暴恐信息';
								    break;
								  case "abuse":
									  status='您的内容包含辱骂信息';
								    break;
								  case "porn":
									  status='您的内容包含色情信息';
								    break;
								  case "flood":
									  status='您的内容包含灌水信息';
								    break;
								  case "contraband":
									  status='您的内容包含违禁信息';
								    break;
								  }
						   }
					  },
					  error:function(data){
						  console.log(data.requestmsg)
					  },
				  })
				  if(status!=""){
					  return status;
				  }
		  },
		  content: function(value, item){ 
			value = ue.getContent()
	    	if(value.length <= 0) {
		      return '请输入正文';
		     }
		  }
		  
	}); 
	  
	  
  form.on('submit(*)', function(data){
	  $("#button-one").addClass("layui-hide");
	  $("#button-two").removeClass("layui-hide").addClass("layui-show");
    	
  });
}); 
UE.Editor.prototype.placeholder = function (justPlainText) {
	var _editor = this;
	_editor.addListener("focus", function () {
		var localHtml = _editor.getPlainTxt();
		if ($.trim(localHtml) === $.trim(justPlainText)) {
			_editor.setContent(" ");
		}
	});
	_editor.addListener("blur", function () {
		var localHtml = _editor.getContent();
		if (!localHtml) {
			_editor.setContent(justPlainText);
		}
	});
	_editor.ready(function () {
		_editor.fireEvent("blur");
	});
};
  var ue = UE.getEditor('content', {
		//这里可以选择自己需要的工具按钮名称
		toolbars: [
			['Source','|', 'undo', 'redo', 'removeformat', 'backcolor', 'formatmatch','|', 'italic', 'underline', 'Bold', 'test',
				'forecolor','|', 'justifyleft', 'justifycenter', 'justifyright','|','insertorderedlist' ,'|',
				'fontfamily', 'fontsize','|',
				 'simpleupload','emotion'
			]
		],
		wordCount: false,					//开启字数统计
		elementPathEnabled : false,
		retainOnlyLabelPasted : true
	});
//placeholder内容(只能是文本内容)
  ue.placeholder("请输入正文");
</script>